// 定义接口，强约束
interface Istate {
	name: string,
	age: number
}
var obj1: Istate
obj1 = { name: "张三", age: 10}

// 可选属性
interface Istate2 {
	name: string,
	age?: number
}
var obj2: Istate2
obj2 = {name: "李四", age: 20}
obj2 = {name: "王五"}

// 属性个数不确定的时候，any必须是任意类型
interface Istate3 {
	name: string,
	age?: number,
	[propName: string]: any
}
var obj3: Istate3 = {name: "张三", sex: "男", isMarray: true, age: 10}

// 只读属性
interface Istate4 {
	name: string,
	readonly age: number
}

var obj4:Istate4 = {name: "张三", age: 10}
obj4.name = "李四"
// 只读属性一旦赋予初始值就不允许对其更改
// obj4.age = 20

export {}